﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Collections;
using System.Data.SqlServerCe;

using Modelo_ETdA.Negocio.Analise;
using Modelo_ETdA.Negocio.Analise.Avaliacao;

namespace Modelo_ETdA.Dados
{
    public class DadosAnalises
    {
        public DadosAnalises() { }

        public List<Consideracao> getListConsideracao()
        {
            List<Consideracao> l_cons = new List<Consideracao>();
            Consideracao aux;
            int cod;
            String desc;
            SqlCeDataReader dataReader = null;

            try
            {
                string cmdstr = "select * from Consideracao ORDER BY cod";
                SqlCeCommand comando = new SqlCeCommand(cmdstr, AdminBD.getConCe());
                dataReader = comando.ExecuteReader();
                while (dataReader.Read())
                {
                    cod = (int)dataReader["cod"];
                    desc = dataReader["descricao"].ToString();
                    aux = new Consideracao(cod, desc);
                    l_cons.Add(aux);
                }
                dataReader.Close();
            }
            catch (SqlCeException e)
            {
                Console.WriteLine(e.ToString());
                if (dataReader != null)
                    if (!(dataReader.IsClosed)) dataReader.Close();
            }
            return l_cons;
        }
    }
}
